package com.gress.shop.dao.impl;

import com.gress.shop.bo.Email;
import com.gress.shop.bo.example.EmailExample;
import com.gress.shop.dao.IEmailDao;
import com.gress.shop.mapper.EmailMapper;
import com.gress.shop.util.UUIDUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class EmailDaoImpl implements IEmailDao {

    @Resource
    private EmailMapper emailMapper;


    @Override
    public int countByExample(EmailExample example) {
        return emailMapper.countByExample(example);
    }

    @Override
    public int insert(Email record) {
        String uuid = UUIDUtil.getUUID();
        record.setId(uuid);
        return emailMapper.insert(record);
    }

    @Override
    public int insertSelective(Email record) {
        String uuid = UUIDUtil.getUUID();
        record.setId(uuid);
        return emailMapper.insertSelective(record);
    }

    @Override
    public List<Email> selectByExample(EmailExample example) {
        return emailMapper.selectByExample(example);
    }

    @Override
    public Email selectByPrimaryKey(String id) {
        return emailMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Email email) {
        return emailMapper.updateByPrimaryKeySelective(email);
    }

}

